﻿/*********************RibbonModel.CoHoi.cs****************************\
 * Module Name: Ribbon Model for tab Co Hoi
 * Author: viettp
\***********************************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OODCRM.Common;
using Microsoft.Windows.Controls.Ribbon;
using System.Windows;

namespace OODCRM.ViewModel
{
    public static partial class RibbonModel
    {

        #region ViewModel

        public static GroupData CoHoi_Group
        {
            get
            {
                lock (_lockObject)
                {
                    string Str = "CoHoi_Group";

                    if (!_dataCollection.ContainsKey(Str))
                    {
                        GroupData groupData = new GroupData("Cơ hội")
                        {
                            IsEnabled = true,
                            SmallImage = new Uri("/OODCRM;component/Images/CoHoi16.png", UriKind.Relative),
                            LargeImage = new Uri("/OODCRM;component/Images/CoHoi32.png", UriKind.Relative)
                        };
                        _dataCollection[Str] = groupData;
                    }

                    return _dataCollection[Str] as GroupData;
                }
            }
        }

        public static ControlData CoHoi_New
        {
            get
            {
                lock (_lockObject)
                {
                    string Str = "CoHoi_New";

                    if (!_dataCollection.ContainsKey(Str))
                    {
                        string ToolTipTitle = "Tạo một cơ hội mới";
                        string ToolTipDescription = "Tạo cơ hội mới và nhập thông tin cơ hội";

                        ButtonData buttonData = new ButtonData()
                        {
                            //Label = "cơ hội mới",
                            SmallImage = new Uri("/OODCRM;component/Images/add1-16.png", UriKind.Relative),
                            ToolTipTitle = ToolTipTitle,
                            ToolTipDescription = ToolTipDescription,
                            Command = new DelegateCommand(CoHoi_NewExecuted, DefaultCanExecute),
                            KeyTip = "N"
                        };
                        _dataCollection[Str] = buttonData;
                    }

                    return _dataCollection[Str];
                }
            }
        }

        public static ControlData CoHoi_Edit
        {
            get
            {
                lock (_lockObject)
                {
                    string Str = "CoHoi_Edit";

                    if (!_dataCollection.ContainsKey(Str))
                    {
                        string ToolTipTitle = "Sửa cơ hội";
                        string ToolTipDescription = "Sửa thông tin cơ hội hiện tại";

                        ButtonData buttonData = new ButtonData()
                        {
                            //Label = "Sửa cơ hội",
                            SmallImage = new Uri("/OODCRM;component/Images/edit16.png", UriKind.Relative),
                            ToolTipTitle = ToolTipTitle,
                            ToolTipDescription = ToolTipDescription,
                            Command = new DelegateCommand(CoHoi_EditExecuted, DefaultCanExecute),
                            KeyTip = "E"
                        };
                        _dataCollection[Str] = buttonData;
                    }

                    return _dataCollection[Str];
                }
            }
        }

        public static ControlData CoHoi_Delete
        {
            get
            {
                lock (_lockObject)
                {
                    string Str = "CoHoi_Delete";

                    if (!_dataCollection.ContainsKey(Str))
                    {
                        string ToolTipTitle = "Loại cơ hội";
                        string ToolTipDescription = "Loại bỏ cơ hội";

                        ButtonData buttonData = new ButtonData()
                        {
                            //Label = "Loại cơ hội",
                            SmallImage = new Uri("/OODCRM;component/Images/delete16.png", UriKind.Relative),
                            ToolTipTitle = ToolTipTitle,
                            ToolTipDescription = ToolTipDescription,
                            Command = new DelegateCommand(CoHoi_DeleteExecuted, DefaultCanExecute),
                            KeyTip = "D"
                        };
                        _dataCollection[Str] = buttonData;
                    }

                    return _dataCollection[Str];
                }
            }
        }

        #region Doi Tac

        public static MenuButtonData CoHoi_DoiTac
        {
            get
            {
                lock (_lockObject)
                {
                    string Str = "CoHoi_DoiTac";

                    if (!_dataCollection.ContainsKey(Str))
                    {
                        MenuButtonData buttonData = new MenuButtonData()
                        {
                            Label = "Đối tác",
                            SmallImage = new Uri("/OODCRM;component/Images/angel_16.png", UriKind.Relative),
                            LargeImage = new Uri("/OODCRM;component/Images/angel_32.png", UriKind.Relative),
                            Command = new DelegateCommand(DefaultExecuted, DefaultCanExecute),
                        };
                        _dataCollection[Str] = buttonData;
                    }

                    return _dataCollection[Str] as MenuButtonData;
                }
            }
        }

        public static ButtonData CoHoi_DoiTac_Add
        {
            get
            {
                lock (_lockObject)
                {
                    string Str = "CoHoi_DoiTac_Add";

                    if (!_dataCollection.ContainsKey(Str))
                    {
                        ButtonData buttonData = new ButtonData()
                        {
                            Label = "Thêm",
                            SmallImage = new Uri("/OODCRM;component/Images/add1-16.png", UriKind.Relative),
                            Command = new DelegateCommand(DefaultExecuted, DefaultCanExecute),
                        };
                        _dataCollection[Str] = buttonData;
                    }

                    return _dataCollection[Str] as ButtonData;
                }
            }
        }

        public static ButtonData CoHoi_DoiTac_Edit
        {
            get
            {
                lock (_lockObject)
                {
                    string Str = "CoHoi_DoiTac_Edit";

                    if (!_dataCollection.ContainsKey(Str))
                    {
                        ButtonData buttonData = new ButtonData()
                        {
                            Label = "Sửa",
                            SmallImage = new Uri("/OODCRM;component/Images/edit16.png", UriKind.Relative),
                            Command = new DelegateCommand(DefaultExecuted, DefaultCanExecute),
                        };
                        _dataCollection[Str] = buttonData;
                    }

                    return _dataCollection[Str] as ButtonData;
                }
            }
        }

        public static ButtonData CoHoi_DoiTac_Remove
        {
            get
            {
                lock (_lockObject)
                {
                    string Str = "CoHoi_DoiTac_Remove";

                    if (!_dataCollection.ContainsKey(Str))
                    {
                        ButtonData buttonData = new ButtonData()
                        {
                            Label = "Loại bỏ",
                            SmallImage = new Uri("/OODCRM;component/Images/delete16.png", UriKind.Relative),
                            Command = new DelegateCommand(DefaultExecuted, DefaultCanExecute),
                        };
                        _dataCollection[Str] = buttonData;
                    }

                    return _dataCollection[Str] as ButtonData;
                }
            }
        }

        #endregion Doi Tac

        #region Doi Thu

        public static MenuButtonData CoHoi_DoiThu
        {
            get
            {
                lock (_lockObject)
                {
                    string Str = "CoHoi_DoiThu";

                    if (!_dataCollection.ContainsKey(Str))
                    {
                        MenuButtonData buttonData = new MenuButtonData()
                        {
                            Label = "Đối thủ",
                            SmallImage = new Uri("/OODCRM;component/Images/devil_16.png", UriKind.Relative),
                            LargeImage = new Uri("/OODCRM;component/Images/devil_32.png", UriKind.Relative),
                            Command = new DelegateCommand(DefaultExecuted, DefaultCanExecute),
                        };
                        _dataCollection[Str] = buttonData;
                    }

                    return _dataCollection[Str] as MenuButtonData;
                }
            }
        }

        public static ButtonData CoHoi_DoiThu_Add
        {
            get
            {
                lock (_lockObject)
                {
                    string Str = "CoHoi_DoiThu_Add";

                    if (!_dataCollection.ContainsKey(Str))
                    {
                        ButtonData buttonData = new ButtonData()
                        {
                            Label = "Thêm",
                            SmallImage = new Uri("/OODCRM;component/Images/add1-16.png", UriKind.Relative),
                            Command = new DelegateCommand(DefaultExecuted, DefaultCanExecute),
                        };
                        _dataCollection[Str] = buttonData;
                    }

                    return _dataCollection[Str] as ButtonData;
                }
            }
        }

        public static ButtonData CoHoi_DoiThu_Edit
        {
            get
            {
                lock (_lockObject)
                {
                    string Str = "CoHoi_DoiThu_Edit";

                    if (!_dataCollection.ContainsKey(Str))
                    {
                        ButtonData buttonData = new ButtonData()
                        {
                            Label = "Sửa",
                            SmallImage = new Uri("/OODCRM;component/Images/edit16.png", UriKind.Relative),
                            Command = new DelegateCommand(DefaultExecuted, DefaultCanExecute),
                        };
                        _dataCollection[Str] = buttonData;
                    }

                    return _dataCollection[Str] as ButtonData;
                }
            }
        }

        public static ButtonData CoHoi_DoiThu_Remove
        {
            get
            {
                lock (_lockObject)
                {
                    string Str = "CoHoi_DoiThu_Remove";

                    if (!_dataCollection.ContainsKey(Str))
                    {
                        ButtonData buttonData = new ButtonData()
                        {
                            Label = "Loại bỏ",
                            SmallImage = new Uri("/OODCRM;component/Images/delete16.png", UriKind.Relative),
                            Command = new DelegateCommand(DefaultExecuted, DefaultCanExecute),
                        };
                        _dataCollection[Str] = buttonData;
                    }

                    return _dataCollection[Str] as ButtonData;
                }
            }
        }

        #endregion Doi Thu

        #endregion ViewModel


        #region Handlers

        internal static void CoHoi_NewExecuted()
        {
            MainWindow crmWindow = CRMWindow;
            if (crmWindow != null)
            {
                crmWindow.CoHoi_NewExecuted();
            }
        }

        internal static void CoHoi_EditExecuted()
        {
            MainWindow crmWindow = CRMWindow;
            if (crmWindow != null)
            {
                crmWindow.CoHoi_EditExecuted();
            }
        }

        internal static void CoHoi_DeleteExecuted()
        {
            MainWindow crmWindow = CRMWindow;
            if (crmWindow != null)
            {
                crmWindow.CoHoi_DeleteExecuted();
            }
        }

       
        #endregion Handlers
    }
}
